<template>
  <view>
    <view class="pt-10 w100 pl-40 pr-40 rowsb rowsm mb-40">
      <view class="" :style="active == index ? 'font-size: 30rpx;color:#4878FF;font-weight: bold;' : 'font-size: 28rpx;color:#888;'" v-for="(item,index) in tab1" :key="index" @click="active = index,getList()">{{item}}</view>
    </view>
    <!-- <view class="w100 pl-60 pr-60 rowsb rowsm mb-30">
      <view class="rowscl rowsm" v-for="(item,index) in tab2" :key="index" @click="active2 = index,getList()">
        <view class="fs-28 col333 fw-b">{{item}}</view>
        <view class="w-40 h-10" style="background: linear-gradient(to bottom,#4897FF,#4878FF);" :style="active2 == index ? 'opacity: 1;' : 'opacity: 0;'"></view>
      </view>
    </view> -->
    
    <view class="w100 pl-24 pr-24">
      <view class="w100 p-all-40 br-20 rows rowsm" style="background-color: #F7F6FA;">
        <image src="/static/icon_ll.png" class="w-52 h-52 mr-20" mode=""></image>
        <view class="fs-30 col333">总分排行：{{data.zfph}}</view>
      </view>
      <view class="w100 p-all-40 br-20 rows rowsm mb-20" style="background-color: #F7F6FA;">
        <image src="/static/icon_ll.png" class="w-52 h-52 mr-20" mode=""></image>
        <view class="fs-30 col333">实践成绩排行：{{data.jfph}}</view>
      </view>
      <view class="w100 p-all-40 br-20 rows rowsm mb-20" style="background-color: #F7F6FA;">
        <image src="/static/icon_ll.png" class="w-52 h-52 mr-20" mode=""></image>
        <view class="fs-30 col333">理论成绩排行：{{data.llph}}</view>
      </view>
     
     
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        tab1:['学院排行','专业排行','年级排行','班级排行'],
        /* tab2:['全部','近一月','近一个学期','近一年'], */
        active:0,
        active2:0,
        data:{}
      };
    },
    onLoad() {
      this.getList()
    },
    methods:{
      getList(){
        let data = {
          type:this.active == 0 ? 'xx' : this.active == 1 ? 'zy' : this.active == 2 ? 'nj' : 'bj'
        }
        if(this.active2 != 0){
          const today = new Date()
          data.stopTime = `${today.getFullYear()}-${+today.getMonth() + 1}-${today.getDate()}`
          if(this.active2 == 1) {
            const date = new Date(today.getTime() - 2592000000)
            data.startTime = `${date.getFullYear()}-${+date.getMonth() + 1}-${date.getDate()}`
          }
          if(this.active2 == 2) {
            const date = new Date(today.getTime() - 15552000000)
            data.startTime = `${date.getFullYear()}-${+date.getMonth() + 1}-${date.getDate()}`
          }
          if(this.active2 == 3) {
            const date = new Date(today.getTime() - 31104000000)
            data.startTime = `${date.getFullYear()}-${+date.getMonth() + 1}-${date.getDate()}`
          }
        }
        
        this.$tools.axiosFromToken('POST','prouser/listPhbUser',{...data},'加载中').then(res => {
          if(res.code != 200) return this.$tools.showtt(res.msg)
          let {data} = res
          this.data = data
        })
      }
    }
  }
</script>

<style lang="scss">
page {
  background-color: #fff;
}
</style>
